" Highlight words
function! HighlightInterestingWord(n)
    " Save our location.
    normal! mz
    " Yank the current word into the z register.
    normal! "zyiw
    " Calculate an arbitrary match ID.  Hopefully nothing else is using it.
    let mid = 86750 + a:n
    " Clear existing matches, but don't worry if they don't exist.
    silent! call matchdelete(mid)
    " Construct a literal pattern that has to match at boundaries.
    let pat = '\V\<' . escape(@z, '\') . '\>'
    " Actually match the words.
    call matchadd("InterestingWord" . a:n, pat, 1, mid)
    " Move back to our original location.
    normal! `z
endfunction

nnoremap <silent> <space>thh :call clearmatches()<cr>:noh<cr>
nnoremap <silent> <space>th1 :call HighlightInterestingWord(1)<cr>
nnoremap <silent> <space>th2 :call HighlightInterestingWord(2)<cr>
nnoremap <silent> <space>th3 :call HighlightInterestingWord(3)<cr>
nnoremap <silent> <space>th4 :call HighlightInterestingWord(4)<cr>
nnoremap <silent> <space>th5 :call HighlightInterestingWord(5)<cr>
nnoremap <silent> <space>th6 :call HighlightInterestingWord(6)<cr>

hi def InterestingWord1 guifg=#000000 ctermfg=16 guibg=#ffa724 ctermbg=214
hi def InterestingWord2 guifg=#000000 ctermfg=16 guibg=#aeee00 ctermbg=154
hi def InterestingWord3 guifg=#000000 ctermfg=16 guibg=#8cffba ctermbg=121
hi def InterestingWord4 guifg=#000000 ctermfg=16 guibg=#b88853 ctermbg=137
hi def InterestingWord5 guifg=#000000 ctermfg=16 guibg=#ff9eb8 ctermbg=211
hi def InterestingWord6 guifg=#000000 ctermfg=16 guibg=#ff2c4b ctermbg=195

highlight search ctermfg=white ctermbg=3423513
